const path = require('path')
class HomeCtl {
  index (ctx) {
    ctx.body = '<h1>主页</h1>'
  }
  upload (ctx) {
    // 上传图片
    const file = ctx.request.files.file
    console.log(ctx.request.files)
    const basename = path.basename(file.path)
    ctx.body = { url: `${ctx.origin}/uploads/${basename}` }
  }
}

module.exports = new HomeCtl()